package day12.DuiXiang.Lx;

import java.io.*;

public class Text {
    public static void main(String[] args) throws IOException {
        Student s1=new Student("张三",23);
        Student s2=new Student("李四",23);
        Student s3=new Student("王五",23);
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("jinjie\\b.txt"));
        oos.writeObject(s1);
        oos.writeObject(s2);
        oos.writeObject(s3);
        oos.close();
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("jinjie\\b.txt"));
        while (true){
            try {
                Object o=ois.readObject();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }catch (EOFException e){
                e.printStackTrace();
                break;
            }
        }
        ois.close();
    }
}
